﻿
#region Using directives

using System;
using System.Collections;
using System.Collections.Specialized;


using System.Web.Configuration;
using System.Data;
using System.Data.Common;
using System.Configuration.Provider;

using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

using ATA.Entities;
using ATA.Data;
using ATA.Data.Bases;

#endregion

namespace ATA.Data.SqlClient
{
	/// <summary>
	/// This class is the Sql implementation of the NetTiersProvider.
	/// </summary>
	public sealed class SqlNetTiersProvider : ATA.Data.Bases.NetTiersProvider
	{
		private static object syncRoot = new Object();
		private string _applicationName;
        private string _connectionString;
        private bool _useStoredProcedure;
        string _providerInvariantName;
		
		/// <summary>
		/// Initializes a new instance of the <see cref="SqlNetTiersProvider"/> class.
		///</summary>
		public SqlNetTiersProvider()
		{	
		}		
		
		/// <summary>
        /// Initializes the provider.
        /// </summary>
        /// <param name="name">The friendly name of the provider.</param>
        /// <param name="config">A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.</param>
        /// <exception cref="T:System.ArgumentNullException">The name of the provider is null.</exception>
        /// <exception cref="T:System.InvalidOperationException">An attempt is made to call <see cref="M:System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection)"></see> on a provider after the provider has already been initialized.</exception>
        /// <exception cref="T:System.ArgumentException">The name of the provider has a length of zero.</exception>
		public override void Initialize(string name, NameValueCollection config)
        {
            // Verify that config isn't null
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            // Assign the provider a default name if it doesn't have one
            if (String.IsNullOrEmpty(name))
            {
                name = "SqlNetTiersProvider";
            }

            // Add a default "description" attribute to config if the
            // attribute doesn't exist or is empty
            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "NetTiers Sql provider");
            }

            // Call the base class's Initialize method
            base.Initialize(name, config);

            // Initialize _applicationName
            _applicationName = config["applicationName"];

            if (string.IsNullOrEmpty(_applicationName))
            {
                _applicationName = "/";
            }
            config.Remove("applicationName");


            #region "Initialize UseStoredProcedure"
            string storedProcedure  = config["useStoredProcedure"];
           	if (string.IsNullOrEmpty(storedProcedure))
            {
                throw new ProviderException("Empty or missing useStoredProcedure");
            }
            this._useStoredProcedure = Convert.ToBoolean(config["useStoredProcedure"]);
            config.Remove("useStoredProcedure");
            #endregion

			#region ConnectionString

			// Initialize _connectionString
			_connectionString = config["connectionString"];
			config.Remove("connectionString");

			string connect = config["connectionStringName"];
			config.Remove("connectionStringName");

			if ( String.IsNullOrEmpty(_connectionString) )
			{
				if ( String.IsNullOrEmpty(connect) )
				{
					throw new ProviderException("Empty or missing connectionStringName");
				}

				if ( DataRepository.ConnectionStrings[connect] == null )
				{
					throw new ProviderException("Missing connection string");
				}

				_connectionString = DataRepository.ConnectionStrings[connect].ConnectionString;
			}

            if ( String.IsNullOrEmpty(_connectionString) )
            {
                throw new ProviderException("Empty connection string");
			}

			#endregion
            
             #region "_providerInvariantName"

            // initialize _providerInvariantName
            this._providerInvariantName = config["providerInvariantName"];

            if (String.IsNullOrEmpty(_providerInvariantName))
            {
                throw new ProviderException("Empty or missing providerInvariantName");
            }
            config.Remove("providerInvariantName");

            #endregion

        }
		
		/// <summary>
		/// Creates a new <c cref="TransactionManager"/> instance from the current datasource.
		/// </summary>
		/// <returns></returns>
		public override TransactionManager CreateTransaction()
		{
			return new TransactionManager(this._connectionString);
		}
		
		/// <summary>
		/// Gets a value indicating whether to use stored procedure or not.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if this repository use stored procedures; otherwise, <c>false</c>.
		/// </value>
		public bool UseStoredProcedure
		{
			get {return this._useStoredProcedure;}
			set {this._useStoredProcedure = value;}
		}
		
		 /// <summary>
        /// Gets or sets the connection string.
        /// </summary>
        /// <value>The connection string.</value>
		public string ConnectionString
		{
			get {return this._connectionString;}
			set {this._connectionString = value;}
		}
		
		/// <summary>
	    /// Gets or sets the invariant provider name listed in the DbProviderFactories machine.config section.
	    /// </summary>
	    /// <value>The name of the provider invariant.</value>
	    public string ProviderInvariantName
	    {
	        get { return this._providerInvariantName; }
	        set { this._providerInvariantName = value; }
	    }		
		
		///<summary>
		/// Indicates if the current <c cref="NetTiersProvider"/> implementation supports Transacton.
		///</summary>
		public override bool IsTransactionSupported
		{
			get
			{
				return true;
			}
		}

		
		#region "KhachHangLapMayPhaMauProvider"
			
		private SqlKhachHangLapMayPhaMauProvider innerSqlKhachHangLapMayPhaMauProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="KhachHangLapMayPhaMau"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override KhachHangLapMayPhaMauProviderBase KhachHangLapMayPhaMauProvider
		{
			get
			{
				if (innerSqlKhachHangLapMayPhaMauProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlKhachHangLapMayPhaMauProvider == null)
						{
							this.innerSqlKhachHangLapMayPhaMauProvider = new SqlKhachHangLapMayPhaMauProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlKhachHangLapMayPhaMauProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlKhachHangLapMayPhaMauProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlKhachHangLapMayPhaMauProvider SqlKhachHangLapMayPhaMauProvider
		{
			get {return KhachHangLapMayPhaMauProvider as SqlKhachHangLapMayPhaMauProvider;}
		}
		
		#endregion
		
		
		#region "ChietKhauProvider"
			
		private SqlChietKhauProvider innerSqlChietKhauProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="ChietKhau"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override ChietKhauProviderBase ChietKhauProvider
		{
			get
			{
				if (innerSqlChietKhauProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlChietKhauProvider == null)
						{
							this.innerSqlChietKhauProvider = new SqlChietKhauProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlChietKhauProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlChietKhauProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlChietKhauProvider SqlChietKhauProvider
		{
			get {return ChietKhauProvider as SqlChietKhauProvider;}
		}
		
		#endregion
		
		
		#region "KhachHangDuthuongProvider"
			
		private SqlKhachHangDuthuongProvider innerSqlKhachHangDuthuongProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="KhachHangDuthuong"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override KhachHangDuthuongProviderBase KhachHangDuthuongProvider
		{
			get
			{
				if (innerSqlKhachHangDuthuongProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlKhachHangDuthuongProvider == null)
						{
							this.innerSqlKhachHangDuthuongProvider = new SqlKhachHangDuthuongProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlKhachHangDuthuongProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlKhachHangDuthuongProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlKhachHangDuthuongProvider SqlKhachHangDuthuongProvider
		{
			get {return KhachHangDuthuongProvider as SqlKhachHangDuthuongProvider;}
		}
		
		#endregion
		
		
		#region "LoaiKhachHangProvider"
			
		private SqlLoaiKhachHangProvider innerSqlLoaiKhachHangProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="LoaiKhachHang"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override LoaiKhachHangProviderBase LoaiKhachHangProvider
		{
			get
			{
				if (innerSqlLoaiKhachHangProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlLoaiKhachHangProvider == null)
						{
							this.innerSqlLoaiKhachHangProvider = new SqlLoaiKhachHangProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlLoaiKhachHangProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlLoaiKhachHangProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlLoaiKhachHangProvider SqlLoaiKhachHangProvider
		{
			get {return LoaiKhachHangProvider as SqlLoaiKhachHangProvider;}
		}
		
		#endregion
		
		
		#region "KhachHangProvider"
			
		private SqlKhachHangProvider innerSqlKhachHangProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="KhachHang"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override KhachHangProviderBase KhachHangProvider
		{
			get
			{
				if (innerSqlKhachHangProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlKhachHangProvider == null)
						{
							this.innerSqlKhachHangProvider = new SqlKhachHangProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlKhachHangProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlKhachHangProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlKhachHangProvider SqlKhachHangProvider
		{
			get {return KhachHangProvider as SqlKhachHangProvider;}
		}
		
		#endregion
		
		
		#region "LoaiThoiGianProvider"
			
		private SqlLoaiThoiGianProvider innerSqlLoaiThoiGianProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="LoaiThoiGian"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override LoaiThoiGianProviderBase LoaiThoiGianProvider
		{
			get
			{
				if (innerSqlLoaiThoiGianProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlLoaiThoiGianProvider == null)
						{
							this.innerSqlLoaiThoiGianProvider = new SqlLoaiThoiGianProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlLoaiThoiGianProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlLoaiThoiGianProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlLoaiThoiGianProvider SqlLoaiThoiGianProvider
		{
			get {return LoaiThoiGianProvider as SqlLoaiThoiGianProvider;}
		}
		
		#endregion
		
		
		#region "RevenueProvider"
			
		private SqlRevenueProvider innerSqlRevenueProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="Revenue"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override RevenueProviderBase RevenueProvider
		{
			get
			{
				if (innerSqlRevenueProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlRevenueProvider == null)
						{
							this.innerSqlRevenueProvider = new SqlRevenueProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlRevenueProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlRevenueProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlRevenueProvider SqlRevenueProvider
		{
			get {return RevenueProvider as SqlRevenueProvider;}
		}
		
		#endregion
		
		
		#region "NhomKhachHangProvider"
			
		private SqlNhomKhachHangProvider innerSqlNhomKhachHangProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="NhomKhachHang"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override NhomKhachHangProviderBase NhomKhachHangProvider
		{
			get
			{
				if (innerSqlNhomKhachHangProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlNhomKhachHangProvider == null)
						{
							this.innerSqlNhomKhachHangProvider = new SqlNhomKhachHangProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlNhomKhachHangProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlNhomKhachHangProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlNhomKhachHangProvider SqlNhomKhachHangProvider
		{
			get {return NhomKhachHangProvider as SqlNhomKhachHangProvider;}
		}
		
		#endregion
		
		
		#region "PhanThuongProvider"
			
		private SqlPhanThuongProvider innerSqlPhanThuongProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="PhanThuong"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override PhanThuongProviderBase PhanThuongProvider
		{
			get
			{
				if (innerSqlPhanThuongProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlPhanThuongProvider == null)
						{
							this.innerSqlPhanThuongProvider = new SqlPhanThuongProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlPhanThuongProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlPhanThuongProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlPhanThuongProvider SqlPhanThuongProvider
		{
			get {return PhanThuongProvider as SqlPhanThuongProvider;}
		}
		
		#endregion
		
		
		#region "HoiVienProvider"
			
		private SqlHoiVienProvider innerSqlHoiVienProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="HoiVien"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override HoiVienProviderBase HoiVienProvider
		{
			get
			{
				if (innerSqlHoiVienProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlHoiVienProvider == null)
						{
							this.innerSqlHoiVienProvider = new SqlHoiVienProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlHoiVienProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlHoiVienProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlHoiVienProvider SqlHoiVienProvider
		{
			get {return HoiVienProvider as SqlHoiVienProvider;}
		}
		
		#endregion
		
		
		#region "NhomSanPhamProvider"
			
		private SqlNhomSanPhamProvider innerSqlNhomSanPhamProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="NhomSanPham"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override NhomSanPhamProviderBase NhomSanPhamProvider
		{
			get
			{
				if (innerSqlNhomSanPhamProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlNhomSanPhamProvider == null)
						{
							this.innerSqlNhomSanPhamProvider = new SqlNhomSanPhamProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlNhomSanPhamProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlNhomSanPhamProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlNhomSanPhamProvider SqlNhomSanPhamProvider
		{
			get {return NhomSanPhamProvider as SqlNhomSanPhamProvider;}
		}
		
		#endregion
		
		
		#region "DonViTinhProvider"
			
		private SqlDonViTinhProvider innerSqlDonViTinhProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="DonViTinh"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override DonViTinhProviderBase DonViTinhProvider
		{
			get
			{
				if (innerSqlDonViTinhProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlDonViTinhProvider == null)
						{
							this.innerSqlDonViTinhProvider = new SqlDonViTinhProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlDonViTinhProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlDonViTinhProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlDonViTinhProvider SqlDonViTinhProvider
		{
			get {return DonViTinhProvider as SqlDonViTinhProvider;}
		}
		
		#endregion
		
		
		#region "ChietKhauSanPhamProvider"
			
		private SqlChietKhauSanPhamProvider innerSqlChietKhauSanPhamProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="ChietKhauSanPham"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override ChietKhauSanPhamProviderBase ChietKhauSanPhamProvider
		{
			get
			{
				if (innerSqlChietKhauSanPhamProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlChietKhauSanPhamProvider == null)
						{
							this.innerSqlChietKhauSanPhamProvider = new SqlChietKhauSanPhamProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlChietKhauSanPhamProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlChietKhauSanPhamProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlChietKhauSanPhamProvider SqlChietKhauSanPhamProvider
		{
			get {return ChietKhauSanPhamProvider as SqlChietKhauSanPhamProvider;}
		}
		
		#endregion
		
		
		#region "ChietKhauNhanhProvider"
			
		private SqlChietKhauNhanhProvider innerSqlChietKhauNhanhProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="ChietKhauNhanh"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override ChietKhauNhanhProviderBase ChietKhauNhanhProvider
		{
			get
			{
				if (innerSqlChietKhauNhanhProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlChietKhauNhanhProvider == null)
						{
							this.innerSqlChietKhauNhanhProvider = new SqlChietKhauNhanhProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlChietKhauNhanhProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlChietKhauNhanhProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlChietKhauNhanhProvider SqlChietKhauNhanhProvider
		{
			get {return ChietKhauNhanhProvider as SqlChietKhauNhanhProvider;}
		}
		
		#endregion
		
		
		#region "ChuongTrinhProvider"
			
		private SqlChuongTrinhProvider innerSqlChuongTrinhProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="ChuongTrinh"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override ChuongTrinhProviderBase ChuongTrinhProvider
		{
			get
			{
				if (innerSqlChuongTrinhProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlChuongTrinhProvider == null)
						{
							this.innerSqlChuongTrinhProvider = new SqlChuongTrinhProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlChuongTrinhProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlChuongTrinhProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlChuongTrinhProvider SqlChuongTrinhProvider
		{
			get {return ChuongTrinhProvider as SqlChuongTrinhProvider;}
		}
		
		#endregion
		
		
		#region "ChietKhauDoanhSoProvider"
			
		private SqlChietKhauDoanhSoProvider innerSqlChietKhauDoanhSoProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="ChietKhauDoanhSo"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override ChietKhauDoanhSoProviderBase ChietKhauDoanhSoProvider
		{
			get
			{
				if (innerSqlChietKhauDoanhSoProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlChietKhauDoanhSoProvider == null)
						{
							this.innerSqlChietKhauDoanhSoProvider = new SqlChietKhauDoanhSoProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlChietKhauDoanhSoProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlChietKhauDoanhSoProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlChietKhauDoanhSoProvider SqlChietKhauDoanhSoProvider
		{
			get {return ChietKhauDoanhSoProvider as SqlChietKhauDoanhSoProvider;}
		}
		
		#endregion
		
		
		#region "ChuongTrinhChiTietProvider"
			
		private SqlChuongTrinhChiTietProvider innerSqlChuongTrinhChiTietProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="ChuongTrinhChiTiet"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override ChuongTrinhChiTietProviderBase ChuongTrinhChiTietProvider
		{
			get
			{
				if (innerSqlChuongTrinhChiTietProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlChuongTrinhChiTietProvider == null)
						{
							this.innerSqlChuongTrinhChiTietProvider = new SqlChuongTrinhChiTietProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlChuongTrinhChiTietProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlChuongTrinhChiTietProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlChuongTrinhChiTietProvider SqlChuongTrinhChiTietProvider
		{
			get {return ChuongTrinhChiTietProvider as SqlChuongTrinhChiTietProvider;}
		}
		
		#endregion
		
		
		#region "DoanhSoCamKetLapMayPhaMauProvider"
			
		private SqlDoanhSoCamKetLapMayPhaMauProvider innerSqlDoanhSoCamKetLapMayPhaMauProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="DoanhSoCamKetLapMayPhaMau"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override DoanhSoCamKetLapMayPhaMauProviderBase DoanhSoCamKetLapMayPhaMauProvider
		{
			get
			{
				if (innerSqlDoanhSoCamKetLapMayPhaMauProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlDoanhSoCamKetLapMayPhaMauProvider == null)
						{
							this.innerSqlDoanhSoCamKetLapMayPhaMauProvider = new SqlDoanhSoCamKetLapMayPhaMauProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlDoanhSoCamKetLapMayPhaMauProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlDoanhSoCamKetLapMayPhaMauProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlDoanhSoCamKetLapMayPhaMauProvider SqlDoanhSoCamKetLapMayPhaMauProvider
		{
			get {return DoanhSoCamKetLapMayPhaMauProvider as SqlDoanhSoCamKetLapMayPhaMauProvider;}
		}
		
		#endregion
		
		
		#region "DieuKienGiamGiaProvider"
			
		private SqlDieuKienGiamGiaProvider innerSqlDieuKienGiamGiaProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="DieuKienGiamGia"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override DieuKienGiamGiaProviderBase DieuKienGiamGiaProvider
		{
			get
			{
				if (innerSqlDieuKienGiamGiaProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlDieuKienGiamGiaProvider == null)
						{
							this.innerSqlDieuKienGiamGiaProvider = new SqlDieuKienGiamGiaProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlDieuKienGiamGiaProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlDieuKienGiamGiaProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlDieuKienGiamGiaProvider SqlDieuKienGiamGiaProvider
		{
			get {return DieuKienGiamGiaProvider as SqlDieuKienGiamGiaProvider;}
		}
		
		#endregion
		
		
		#region "DoanhSoCamKetProvider"
			
		private SqlDoanhSoCamKetProvider innerSqlDoanhSoCamKetProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="DoanhSoCamKet"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override DoanhSoCamKetProviderBase DoanhSoCamKetProvider
		{
			get
			{
				if (innerSqlDoanhSoCamKetProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlDoanhSoCamKetProvider == null)
						{
							this.innerSqlDoanhSoCamKetProvider = new SqlDoanhSoCamKetProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlDoanhSoCamKetProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlDoanhSoCamKetProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlDoanhSoCamKetProvider SqlDoanhSoCamKetProvider
		{
			get {return DoanhSoCamKetProvider as SqlDoanhSoCamKetProvider;}
		}
		
		#endregion
		
		
		#region "ThuongHieuProvider"
			
		private SqlThuongHieuProvider innerSqlThuongHieuProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="ThuongHieu"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override ThuongHieuProviderBase ThuongHieuProvider
		{
			get
			{
				if (innerSqlThuongHieuProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlThuongHieuProvider == null)
						{
							this.innerSqlThuongHieuProvider = new SqlThuongHieuProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlThuongHieuProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlThuongHieuProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlThuongHieuProvider SqlThuongHieuProvider
		{
			get {return ThuongHieuProvider as SqlThuongHieuProvider;}
		}
		
		#endregion
		
		
		#region "DoanhSoProvider"
			
		private SqlDoanhSoProvider innerSqlDoanhSoProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="DoanhSo"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override DoanhSoProviderBase DoanhSoProvider
		{
			get
			{
				if (innerSqlDoanhSoProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlDoanhSoProvider == null)
						{
							this.innerSqlDoanhSoProvider = new SqlDoanhSoProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlDoanhSoProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlDoanhSoProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlDoanhSoProvider SqlDoanhSoProvider
		{
			get {return DoanhSoProvider as SqlDoanhSoProvider;}
		}
		
		#endregion
		
		
		
		#region "VwAllCustomersProvider"
		
		private SqlVwAllCustomersProvider innerSqlVwAllCustomersProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="VwAllCustomers"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override VwAllCustomersProviderBase VwAllCustomersProvider
		{
			get
			{
				if (innerSqlVwAllCustomersProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlVwAllCustomersProvider == null)
						{
							this.innerSqlVwAllCustomersProvider = new SqlVwAllCustomersProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlVwAllCustomersProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlVwAllCustomersProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlVwAllCustomersProvider SqlVwAllCustomersProvider
		{
			get {return VwAllCustomersProvider as SqlVwAllCustomersProvider;}
		}
		
		#endregion
		
		
		#region "VwDoanhSoProvider"
		
		private SqlVwDoanhSoProvider innerSqlVwDoanhSoProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="VwDoanhSo"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override VwDoanhSoProviderBase VwDoanhSoProvider
		{
			get
			{
				if (innerSqlVwDoanhSoProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlVwDoanhSoProvider == null)
						{
							this.innerSqlVwDoanhSoProvider = new SqlVwDoanhSoProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlVwDoanhSoProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlVwDoanhSoProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlVwDoanhSoProvider SqlVwDoanhSoProvider
		{
			get {return VwDoanhSoProvider as SqlVwDoanhSoProvider;}
		}
		
		#endregion
		
		
		#region "VwGetAllDoanhSoProvider"
		
		private SqlVwGetAllDoanhSoProvider innerSqlVwGetAllDoanhSoProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="VwGetAllDoanhSo"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override VwGetAllDoanhSoProviderBase VwGetAllDoanhSoProvider
		{
			get
			{
				if (innerSqlVwGetAllDoanhSoProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlVwGetAllDoanhSoProvider == null)
						{
							this.innerSqlVwGetAllDoanhSoProvider = new SqlVwGetAllDoanhSoProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlVwGetAllDoanhSoProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlVwGetAllDoanhSoProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlVwGetAllDoanhSoProvider SqlVwGetAllDoanhSoProvider
		{
			get {return VwGetAllDoanhSoProvider as SqlVwGetAllDoanhSoProvider;}
		}
		
		#endregion
		
		
		#region "VwGetTotalMonthlyRevenueProvider"
		
		private SqlVwGetTotalMonthlyRevenueProvider innerSqlVwGetTotalMonthlyRevenueProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="VwGetTotalMonthlyRevenue"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override VwGetTotalMonthlyRevenueProviderBase VwGetTotalMonthlyRevenueProvider
		{
			get
			{
				if (innerSqlVwGetTotalMonthlyRevenueProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlVwGetTotalMonthlyRevenueProvider == null)
						{
							this.innerSqlVwGetTotalMonthlyRevenueProvider = new SqlVwGetTotalMonthlyRevenueProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlVwGetTotalMonthlyRevenueProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlVwGetTotalMonthlyRevenueProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlVwGetTotalMonthlyRevenueProvider SqlVwGetTotalMonthlyRevenueProvider
		{
			get {return VwGetTotalMonthlyRevenueProvider as SqlVwGetTotalMonthlyRevenueProvider;}
		}
		
		#endregion
		
		
		#region "VwInventoryItemProvider"
		
		private SqlVwInventoryItemProvider innerSqlVwInventoryItemProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="VwInventoryItem"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override VwInventoryItemProviderBase VwInventoryItemProvider
		{
			get
			{
				if (innerSqlVwInventoryItemProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlVwInventoryItemProvider == null)
						{
							this.innerSqlVwInventoryItemProvider = new SqlVwInventoryItemProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlVwInventoryItemProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlVwInventoryItemProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlVwInventoryItemProvider SqlVwInventoryItemProvider
		{
			get {return VwInventoryItemProvider as SqlVwInventoryItemProvider;}
		}
		
		#endregion
		
		
		#region "VwKhachHangLapMayPhaMauProvider"
		
		private SqlVwKhachHangLapMayPhaMauProvider innerSqlVwKhachHangLapMayPhaMauProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="VwKhachHangLapMayPhaMau"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override VwKhachHangLapMayPhaMauProviderBase VwKhachHangLapMayPhaMauProvider
		{
			get
			{
				if (innerSqlVwKhachHangLapMayPhaMauProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlVwKhachHangLapMayPhaMauProvider == null)
						{
							this.innerSqlVwKhachHangLapMayPhaMauProvider = new SqlVwKhachHangLapMayPhaMauProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlVwKhachHangLapMayPhaMauProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlVwKhachHangLapMayPhaMauProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlVwKhachHangLapMayPhaMauProvider SqlVwKhachHangLapMayPhaMauProvider
		{
			get {return VwKhachHangLapMayPhaMauProvider as SqlVwKhachHangLapMayPhaMauProvider;}
		}
		
		#endregion
		
		
		#region "VwMisaBranchesProvider"
		
		private SqlVwMisaBranchesProvider innerSqlVwMisaBranchesProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="VwMisaBranches"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override VwMisaBranchesProviderBase VwMisaBranchesProvider
		{
			get
			{
				if (innerSqlVwMisaBranchesProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlVwMisaBranchesProvider == null)
						{
							this.innerSqlVwMisaBranchesProvider = new SqlVwMisaBranchesProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlVwMisaBranchesProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlVwMisaBranchesProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlVwMisaBranchesProvider SqlVwMisaBranchesProvider
		{
			get {return VwMisaBranchesProvider as SqlVwMisaBranchesProvider;}
		}
		
		#endregion
		
		
		#region "VwMisaCustomersProvider"
		
		private SqlVwMisaCustomersProvider innerSqlVwMisaCustomersProvider;

		///<summary>
		/// This class is the Data Access Logic Component for the <see cref="VwMisaCustomers"/> business entity.
		/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
		///</summary>
		/// <value></value>
		public override VwMisaCustomersProviderBase VwMisaCustomersProvider
		{
			get
			{
				if (innerSqlVwMisaCustomersProvider == null) 
				{
					lock (syncRoot) 
					{
						if (innerSqlVwMisaCustomersProvider == null)
						{
							this.innerSqlVwMisaCustomersProvider = new SqlVwMisaCustomersProvider(_connectionString, _useStoredProcedure, _providerInvariantName);
						}
					}
				}
				return innerSqlVwMisaCustomersProvider;
			}
		}
		
		/// <summary>
		/// Gets the current <c cref="SqlVwMisaCustomersProvider"/>.
		/// </summary>
		/// <value></value>
		public SqlVwMisaCustomersProvider SqlVwMisaCustomersProvider
		{
			get {return VwMisaCustomersProvider as SqlVwMisaCustomersProvider;}
		}
		
		#endregion
		
		
		#region "General data access methods"

		#region "ExecuteNonQuery"
		/// <summary>
		/// Executes the non query.
		/// </summary>
		/// <param name="storedProcedureName">Name of the stored procedure.</param>
		/// <param name="parameterValues">The parameter values.</param>
		/// <returns></returns>
		public override int ExecuteNonQuery(string storedProcedureName, params object[] parameterValues)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			return database.ExecuteNonQuery(storedProcedureName, parameterValues);	
		}

		/// <summary>
		/// Executes the non query.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="storedProcedureName">Name of the stored procedure.</param>
		/// <param name="parameterValues">The parameter values.</param>
		/// <returns></returns>
		public override int ExecuteNonQuery(TransactionManager transactionManager, string storedProcedureName, params object[] parameterValues)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			return database.ExecuteNonQuery(transactionManager.TransactionObject, storedProcedureName, parameterValues);	
		}

		/// <summary>
		/// Executes the non query.
		/// </summary>
		/// <param name="commandWrapper">The command wrapper.</param>
		public override void ExecuteNonQuery(DbCommand commandWrapper)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			database.ExecuteNonQuery(commandWrapper);	
			
		}

		/// <summary>
		/// Executes the non query.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="commandWrapper">The command wrapper.</param>
		public override void ExecuteNonQuery(TransactionManager transactionManager, DbCommand commandWrapper)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			database.ExecuteNonQuery(commandWrapper, transactionManager.TransactionObject);	
		}


		/// <summary>
		/// Executes the non query.
		/// </summary>
		/// <param name="commandType">Type of the command.</param>
		/// <param name="commandText">The command text.</param>
		/// <returns></returns>
		public override int ExecuteNonQuery(CommandType commandType, string commandText)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			return database.ExecuteNonQuery(commandType, commandText);	
		}
		/// <summary>
		/// Executes the non query.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="commandType">Type of the command.</param>
		/// <param name="commandText">The command text.</param>
		/// <returns></returns>
		public override int ExecuteNonQuery(TransactionManager transactionManager, CommandType commandType, string commandText)
		{
			Database database = transactionManager.Database;			
			return database.ExecuteNonQuery(transactionManager.TransactionObject , commandType, commandText);				
		}
		#endregion

		#region "ExecuteDataReader"
		/// <summary>
		/// Executes the reader.
		/// </summary>
		/// <param name="storedProcedureName">Name of the stored procedure.</param>
		/// <param name="parameterValues">The parameter values.</param>
		/// <returns></returns>
		public override IDataReader ExecuteReader(string storedProcedureName, params object[] parameterValues)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);			
			return database.ExecuteReader(storedProcedureName, parameterValues);	
		}

		/// <summary>
		/// Executes the reader.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="storedProcedureName">Name of the stored procedure.</param>
		/// <param name="parameterValues">The parameter values.</param>
		/// <returns></returns>
		public override IDataReader ExecuteReader(TransactionManager transactionManager, string storedProcedureName, params object[] parameterValues)
		{
			Database database = transactionManager.Database;
			return database.ExecuteReader(transactionManager.TransactionObject, storedProcedureName, parameterValues);	
		}

		/// <summary>
		/// Executes the reader.
		/// </summary>
		/// <param name="commandWrapper">The command wrapper.</param>
		/// <returns></returns>
		public override IDataReader ExecuteReader(DbCommand commandWrapper)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);			
			return database.ExecuteReader(commandWrapper);	
		}

		/// <summary>
		/// Executes the reader.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="commandWrapper">The command wrapper.</param>
		/// <returns></returns>
		public override IDataReader ExecuteReader(TransactionManager transactionManager, DbCommand commandWrapper)
		{
			Database database = transactionManager.Database;
			return database.ExecuteReader(commandWrapper, transactionManager.TransactionObject);	
		}


		/// <summary>
		/// Executes the reader.
		/// </summary>
		/// <param name="commandType">Type of the command.</param>
		/// <param name="commandText">The command text.</param>
		/// <returns></returns>
		public override IDataReader ExecuteReader(CommandType commandType, string commandText)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			return database.ExecuteReader(commandType, commandText);	
		}
		/// <summary>
		/// Executes the reader.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="commandType">Type of the command.</param>
		/// <param name="commandText">The command text.</param>
		/// <returns></returns>
		public override IDataReader ExecuteReader(TransactionManager transactionManager, CommandType commandType, string commandText)
		{
			Database database = transactionManager.Database;			
			return database.ExecuteReader(transactionManager.TransactionObject , commandType, commandText);				
		}
		#endregion

		#region "ExecuteDataSet"
		/// <summary>
		/// Executes the data set.
		/// </summary>
		/// <param name="storedProcedureName">Name of the stored procedure.</param>
		/// <param name="parameterValues">The parameter values.</param>
		/// <returns></returns>
		public override DataSet ExecuteDataSet(string storedProcedureName, params object[] parameterValues)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);			
			return database.ExecuteDataSet(storedProcedureName, parameterValues);	
		}

		/// <summary>
		/// Executes the data set.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="storedProcedureName">Name of the stored procedure.</param>
		/// <param name="parameterValues">The parameter values.</param>
		/// <returns></returns>
		public override DataSet ExecuteDataSet(TransactionManager transactionManager, string storedProcedureName, params object[] parameterValues)
		{
			Database database = transactionManager.Database;
			return database.ExecuteDataSet(transactionManager.TransactionObject, storedProcedureName, parameterValues);	
		}

		/// <summary>
		/// Executes the data set.
		/// </summary>
		/// <param name="commandWrapper">The command wrapper.</param>
		/// <returns></returns>
		public override DataSet ExecuteDataSet(DbCommand commandWrapper)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);			
			return database.ExecuteDataSet(commandWrapper);	
		}

		/// <summary>
		/// Executes the data set.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="commandWrapper">The command wrapper.</param>
		/// <returns></returns>
		public override DataSet ExecuteDataSet(TransactionManager transactionManager, DbCommand commandWrapper)
		{
			Database database = transactionManager.Database;
			return database.ExecuteDataSet(commandWrapper, transactionManager.TransactionObject);	
		}


		/// <summary>
		/// Executes the data set.
		/// </summary>
		/// <param name="commandType">Type of the command.</param>
		/// <param name="commandText">The command text.</param>
		/// <returns></returns>
		public override DataSet ExecuteDataSet(CommandType commandType, string commandText)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			return database.ExecuteDataSet(commandType, commandText);	
		}
		/// <summary>
		/// Executes the data set.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="commandType">Type of the command.</param>
		/// <param name="commandText">The command text.</param>
		/// <returns></returns>
		public override DataSet ExecuteDataSet(TransactionManager transactionManager, CommandType commandType, string commandText)
		{
			Database database = transactionManager.Database;			
			return database.ExecuteDataSet(transactionManager.TransactionObject , commandType, commandText);				
		}
		#endregion

		#region "ExecuteScalar"
		/// <summary>
		/// Executes the scalar.
		/// </summary>
		/// <param name="storedProcedureName">Name of the stored procedure.</param>
		/// <param name="parameterValues">The parameter values.</param>
		/// <returns></returns>
		public override object ExecuteScalar(string storedProcedureName, params object[] parameterValues)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);			
			return database.ExecuteScalar(storedProcedureName, parameterValues);	
		}

		/// <summary>
		/// Executes the scalar.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="storedProcedureName">Name of the stored procedure.</param>
		/// <param name="parameterValues">The parameter values.</param>
		/// <returns></returns>
		public override object ExecuteScalar(TransactionManager transactionManager, string storedProcedureName, params object[] parameterValues)
		{
			Database database = transactionManager.Database;
			return database.ExecuteScalar(transactionManager.TransactionObject, storedProcedureName, parameterValues);	
		}

		/// <summary>
		/// Executes the scalar.
		/// </summary>
		/// <param name="commandWrapper">The command wrapper.</param>
		/// <returns></returns>
		public override object ExecuteScalar(DbCommand commandWrapper)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);			
			return database.ExecuteScalar(commandWrapper);	
		}

		/// <summary>
		/// Executes the scalar.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="commandWrapper">The command wrapper.</param>
		/// <returns></returns>
		public override object ExecuteScalar(TransactionManager transactionManager, DbCommand commandWrapper)
		{
			Database database = transactionManager.Database;
			return database.ExecuteScalar(commandWrapper, transactionManager.TransactionObject);	
		}

		/// <summary>
		/// Executes the scalar.
		/// </summary>
		/// <param name="commandType">Type of the command.</param>
		/// <param name="commandText">The command text.</param>
		/// <returns></returns>
		public override object ExecuteScalar(CommandType commandType, string commandText)
		{
			SqlDatabase database = new SqlDatabase(this._connectionString);
			return database.ExecuteScalar(commandType, commandText);	
		}
		/// <summary>
		/// Executes the scalar.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="commandType">Type of the command.</param>
		/// <param name="commandText">The command text.</param>
		/// <returns></returns>
		public override object ExecuteScalar(TransactionManager transactionManager, CommandType commandType, string commandText)
		{
			Database database = transactionManager.Database;			
			return database.ExecuteScalar(transactionManager.TransactionObject , commandType, commandText);				
		}
		#endregion

		#endregion


	}
}
